import { defineStore } from "pinia";
import useAppConfigUserStore from "./appConfig-user";
/**这些配置是与用户无关的，不会存到localStorege */
const useAppConfigStore = defineStore("appConfig", {
  state: () => ({
    appConfigDrawerVisible: false,
    sideMenuVisible: false,
    isMobile: false,
    isPhone: false,
    isPad: false,
		isMaximize: false, // 当前页面是否全屏
  }),

  actions: {
    toggleAppConfigDrawerVisible(value: boolean) {
      this.appConfigDrawerVisible = value;
    },
    toggleIsMobile(isMobile: boolean) {
      this.isMobile = isMobile;
    },
    toggleIsPhone(isPhone: boolean) {
      this.isPhone = isPhone;
      if (isPhone == true) {
        useAppConfigUserStore().setSideMenu(false)
      }
    },
    toggleMenuVisible() {
      this.sideMenuVisible = !this.sideMenuVisible;
    },
    setMaximize(value:boolean) {
      this.isMaximize = value
		const app = document.getElementById("app") as HTMLElement;
      if (value) {
        app.classList.add("main-maximize");
      } else {
        app.classList.remove("main-maximize");
      }
    }
  },
});
export default useAppConfigStore;
